<template>
  <el-container>
    <!-- 侧边栏导航 -->
    <el-aside width="20.5rem"  ref="aside" >
      <Aside :collapse="collapse" :page="page"></Aside>
    </el-aside>
    <el-container >
      <!-- 头部区域 -->
      <el-header height='5rem' style="padding:0; ">
        <Header :collapse="collapse" :page="page"></Header>
      </el-header>
      <!-- 内容区 -->
      <el-main >
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
import Aside from "../components/Aside.vue";
import Header from "../components/Header.vue";
export default {
  data() {
    return {
      collapse: { isHidden: false }, // 侧边栏菜单
      page: { name: "" }, // 页头导航 面包屑
    };
  },
  created(){
    this.page.name=this.$route.meta.title
  },
  watch: {
    collapse: {
      handler(val) {
        if (val.isHidden) {
          this.$refs.aside.$el.style.width = "5rem"
          
        } else {
          this.$refs.aside.$el.style.width = "20.5rem"
        }
      },
      deep:true
    },
  },
  components: {
    Aside,
    Header,
  },
};
</script>

<style scoped>
/* .el-container{
  height: 100vh;
} */
.el-header,
.el-footer {
  background-color: #303133;
  color: #333;
  text-align: center;
}

.el-aside /deep/{

  height: 100vh;
  width:20.5rem;
  background-color: #304156;
  color: #333;
  /*text-align: center;*/
}

.el-main  {
  
  background-color: #fff;
  color: #333;
height: calc(100vh - 50px);     
  min-width: 60rem;
  text-align: center;
}
</style>